class Solution(object):
    def intersect(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: List[int]
        """
        sorted_nums1 = sorted(nums1)
        sorted_nums2 = sorted(nums2)

        index1 = 0
        index2 = 0
        inter_res = []
        while index1 < len(sorted_nums1) and index2 < len(sorted_nums2):
            if sorted_nums1[index1] == sorted_nums2[index2]:
                inter_res.append(sorted_nums1[index1])
                index1 += 1
                index2 += 1
            elif sorted_nums1[index1] < sorted_nums2[index2]:
                index1 += 1
            else:
                index2 += 1
        return inter_res
